package com.mhkj.base.functionOffice.entity;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;
import javax.persistence.Transient;

import com.mhkj.base.rbac.role.entity.SystemRole;
import com.mics.core.common.validate.annotation.Unique;
import com.mics.core.common.validate.annotation.Validate;
import com.mics.core.system.base.entity.BaseDomain;

/**
 * 职能部门
 * @author mics
 * @date 2018年9月17日
 * @version 1.0
 */
@Entity
@Table(name="t_function_office")
@Validate
public class FunctionOffice extends BaseDomain{

	/**
	 * 序列号
	 */
	private static final long serialVersionUID = -1742714012527961032L;
	
	/**
	 * 部门名称
	 */
	@Unique(message="部门名称不能重复")
	@Column(name="name",length=48)
	private String name;
	
	/**
	 * 部门编码
	 */
	@Column(name="code",length=48)
	private String code;
	
	/**
	 * 备注
	 */
	@Column(name="remark",length=225)
	private String remark;
	

	/**
	 * 创建人
	 */
	@Transient
	private String createName;
	
	/**
	 * 系统角色
	 */
	@ManyToMany(fetch=FetchType.LAZY)
	@JoinTable(name = "t_sys_role_function",joinColumns = {@JoinColumn(name = "function_id", referencedColumnName = "id")},
	inverseJoinColumns = {@JoinColumn(name = "sysRole_id", referencedColumnName ="id")})
	private List<SystemRole> systemRoles;
	
	
	
	public List<SystemRole> getSystemRoles() {
		return systemRoles;
	}

	public void setSystemRoles(List<SystemRole> systemRoles) {
		this.systemRoles = systemRoles;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public String getCreateName() {
		return createName;
	}

	public void setCreateName(String createName) {
		this.createName = createName;
	}
	
	
}
